<?php
/**
 * Contact Deletion Popup
 * 
 * @author Xavier VILAIN
 * @package Hive\Contact
 * @license #license-hive#
 */

use Hive\Ressource;
use Fox\Popup\ToConfirm\Deletion;
use Fox\Generator;

$carousel = Xview::instance()->val('carousel',false);
$id = Xview::instance()->val('inlineid',false);
if(!empty($carousel)) {
	$reloadGen = "CarouselRemoveItem($id);";
} else {
	$reloadGen = Generator::redirect(Generator::url('ressource','search'));
}

$deletion = new Deletion('deleteForm',
						Ressource::className(),
						array(Fox\Msg::BUNDLE,Fox\Msg::MSG_DELETE_HDR),
						array(Hive::BUNDLE,Hive::CONTACT_DELETION_CONFIRMATION),
						array(Fox\Msg::BUNDLE,Fox\Msg::MSG_DELETE),
						$reloadGen
					);
echo $deletion->render();
/*
if($xview->val('confirmation'))
{
	try {
		$contact->delete();
		Fox\Message::Information(Msg(Fox::MSGCL,Fox\Msg::MSG_DELETE,$label));
		exit;
	}
	catch (Fox\Object\Exception\Save $e)
	{
		Fox\Message::Error($e->getMessage());
	}
}


$yesAction = Generator::ajax(Generator::url('ressource','delete',null,array('rid' => $rid,'carousel' => $carousel)),
							'&confirmation=true',
							$reloadGen,'hdeleteForm','RF',2
);

$popup = new Fox\Popup\ToConfirm('deleteForm',Msg(Fox\Msg::BUNDLE,Fox\Msg::MSG_DELETE_HDR), Msg(Hive::BUNDLE,14,$label),$yesAction,null,400);
echo $popup->Display();
*/